package daos;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConnector {
	static {
		try {
			Class.forName("com.mysql.jdbc.Driver").newInstance();
		} catch (Exception e) {
			throw new RuntimeException(e);
		} 
	}

	public Connection getConnection() throws SQLException {
		Connection conn=DriverManager.getConnection("jdbc:mysql://localhost/ejemplo?" +
                "user=root&password=root");
		System.out.println ("Database connection established");
		return conn;
	}
	
	public void cerrarConeccion(Connection conn){
		try {
			conn.close();
		} catch (SQLException e) {
			
		}
	} 
}
